import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * author:  Wang Yunlong
 * times:    2016-01-24
 * purpose:
 **/
public class App {

    private static Logger LOG = LoggerFactory.getLogger(App.class);

    public static void main(String... args) throws IOException,
            InterruptedException {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:dubbo-user-provider.xml");
        context.start();
        context.refresh();
        System.out.printf("服务开始...");
        Thread springThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    while (true) {
                        TimeUnit.DAYS.sleep(2);
                    }
                } catch (InterruptedException e) {
                    LOG.error("App.main error:{}", e.getMessage());
                }

            }
        });
        springThread.start();
        springThread.join();
    }
}
